Taco Mail

Personalise your Trello Emails

This app gives you a personal email capability which you can use within your Trello automation and/or any other apps. It uses the http request to call your app.

It is designed to work with another Deta Space app as the SMTP relay and it allows you to merge your card data into the email. This allows you to deliver custom emails using your email(s) that supports SMTP.

You can send email using a template, overwrite any part of the template, include a report variable, checklist, labels…etc.

The user interface is kept simple. It allows you to see your templates, create new template or update an existing.

Documentation on this app is available at milynnus Blog-Doc under the tag tacomail

Install the app

The app is available on Deta Space Discovery.

Configure the app

You will need to configure the app by going to Settings > Configuration

Here's a brief explanation on each of the requested data :

  • TRELLO_API_KEY this the Trello api key to be used for this instance
  • TRELLO_TOKEN this is your Trello Token
  • SMTP_HOSTNAME this is the hostname of your mySMTP instance
  • TIMEZONE this is the timezone for all date time conversion. A list of the valid timezones can be found at

Email Templates

After completing the above configuration and you open the app for the first time, a email_templates base is created for you and the key is the loaded is _sample.

See the The App UI section below.

A template has the following fields:

  • key : this is a system generated key for the template
  • name : this is the name of the template.
  • subject : this is for the subject line
  • open : this is for the opening paragraph or header
  • main : this is for the main email body
  • close : this is for the closing paragraph or footer

You can use
for line breaks. This works for most emails that supports html.

Merge card data and other Trello variables

Since Trello uses {variable}, {%custom_field} and {$report_variable} ..etc the notation to be used to include card data values will be in this format <<placeholder>>. This can be applied to the subject, open, main and close fields of a template.

The following are the placeholder name that can be use in place of the <<placeholder>> :

  • cardname - the card name
  • carddescription - the card description
  • cardduedate - the card due date
  • cardstartdate - the card start date
  • cardlistname - the current list name
  • cardboardname - the board name for the card
  • any custom field will be have a prefix % e.g.
    • %Price
    • %Applied Rate
    • %app_name

Here's an example of what you can specify in main :

Please take note of the new rates that will be your account with this name <<cardname>> : <br><br>Late Charge : <<%late_charge_percent>> per annum<br><br>Days after notice : <<%late_charge_days>> days.

where

  • the card name is the name of the account holder
  • there exist custom fields with names : late_charge_percent and late_charge_days

and the values will be merged into the placeholders

HTTP Services

The services are called with a POST http request.

<instance url>/include

Use this path to generate HTML equivalent of :

  • checklist
    • you can specify either all or a specific checklist to be created
  • label
    • report - for Trello report variable

with a payload (example)

Case 1 :

{“card_id” : “{triggercardidlong}”, "include" : { “checklist” : “all”,“label” : “Header of labels” } }

Case 2:

{"include" : { "report" : "{$report}" } }

The HTML equivalent are available by using the following variables

  • {httpresponse.checklist}
  • {httpresponse.label}
  • {httpresponse.report}

<instance url>/sendmail

Use this path to send email using the mySMTP app or equivalent :

  • card_id
    • required when you have reference to card specific content in your template, overwrite or include
    • for <> in your template will need the card id to get the card name and merged into the placeholder on the template
  • email_template
    • this is the name of the email template
  • overwrite
    • where you specify the section/fields in the template you want to overwrite. You can overwrite any of the sections
  • include
    • where you specify the HTML content you want to include in the email. All the HTML will be inserted at the <<include>> placeholder
    • if a dictionary of key value pairs is provided, then the keys can be used inside your template using <>

with a payload (example)

Case 1

{“card_id” : “{triggercardidlong}”, "email": "clientemail@gmail.com", "email_template": "trello_test", "overwrite": {"subject" : "This is a report generated from Trello", "open" : "Should you have any questions, please call me.", "main" : "Your report<br> <<include>><br>" }, "include" : "<br>{httpresponse.label}<br><br>{httpresponse.checklist}<br>" }

Case 2

{"email": "clientemail@gmail.com", "email_template": "trello_test","overwrite": {"subject" : "This is a report generated from Trello", "open" : "Should you have any questions, please call me.", "main" : "Your report<br> <<include>><br>" }, "include" : "{httpresponse.report}" }

With the include option in the payload you can, in fact, add any Trello variable that are available during the Trello automation execution with HTML to customise the email with **endless possibilities**. The only exception is that there is only a single placeholder for all the variables and HTML.

"include" : "The last activity on this card was {cardlastactivitydate~dddd, MMMM Do YYYY, h:mm:ss a}<br><br>Here are all the labels and colors on this card {cardlabels}"

Overwrite and Include Use Case

Let’s look at this automation to help understand how you can overwrite any part of a template and include other details into the email.

The objective is to use an existing template, overwrite the subject line, open and main sections so that the contents of a report and be sent to a client.

here’s a calendar command to create a report with special_report as the report variable

every Monday at 16:02, create a report in variable "special_report" with all cards using pattern "- {cardname} with due date {cardduedate} was created on {cardcreationisodatetime} is current on {cardilistname} for {cardagedays} days" group by list,

It calls the /include and it will create the HTML equivalent for the special report. This creates the HTML equivalent of the report in {httpresponse.report}

post to url "https://taco_mail-1-k96...23.deta.app/include" with payload "{"include" : { "report" : "{$special_report}" }",

It calls the /sendmail to send an email to the client using the trello_test template but the subject line, open and main sections of the template will be overwritten. In particular, the main section has <<include>> as the placeholder to add the HTML of the report from prior step in the main section of the email and "include" : "{httpresponse.report}" to the endpoint to insert it correctly in the main section.

and post to url "https://taco_mail-1-k96....23.deta.app/sendmail" with payload "{"email": "clientemail@gmail.com", "email_template": "trello_test", "overwrite": {"subject" : "This is a report generated from Trello", "open" : "Should you have any questions, please call me.", "main" : "Your report<br> <<include>> <br>" }, "include" : "{httpresponse.report}" }"

The App UI

The app UI shows a list of email templates.

There is a button Create a template. When you click on the button you will be presented with this pop up for fill in the sections. You can include text include any HTML.

**Note** that there is no preview of the email. Please check your form before submitting the the form

There is a button Update a template. When you click on the button you will be presented with this pop up and this allows you to :

update any of the sections

click the checkbox to delete the template

Email Examples

This example was created :100: with Taco Mail :

Template

Trello Button Command

post to url "https://taco_mail-1-k9....723.deta.app/sendmail" with payload "{"email": "clientemail@gmail.com", "card_id": "{cardidlong}","email_template": "taco","overwrite": {}, "include" : "Your order was created on {cardcreationdate~dddd, MMMM Do YYYY, h:mm:ss a} and notice of delivery has been executed within {cardageminutes} minutes <br><br>The job status is marked as follows : {cardlabels}<br><br>" }"

Email created

Now, this is possible! You can include HTML equivalent of labels on checklist in your email.

The card description can now be presented in the email such shown :